package exp4.test3;

/**
 * Created by 春旺 on 2017/11/23.
 */
public class NetMain {
    public static void main(String[] args) {
        MakeGraph graph = new MakeGraph();
        graph.addVex("a");
        graph.addVex("b");
        graph.addVex("c");
        graph.addVex("d");
        graph.addVex("e");

        Edge edge2 = new Edge("a","b",4);
        Edge edge3 = new Edge("a","c",6);
        Edge edge5 = new Edge("e","c",15);
        Edge edge6 = new Edge("b","d",13);
        Edge edge8 = new Edge("c","d",25);

        graph.addEdged(edge2);
        graph.addEdged(edge3);
        graph.addEdged(edge5);
        graph.addEdged(edge6);
        graph.addEdged(edge8);

        int target = 0;
        int[] shortestPath= Net.Dijsktra(graph.weight,target);
        System.out.println("从  "+graph.vexList.get(target) + " 出发：");
        for (int index=0;index<shortestPath.length;index++){
            if(index != target)
            System.out.println("         到  "+graph.vexList.get(index)
                    +"  的最短路径（最便宜）为："+shortestPath[index]+ " 万元") ;
        }
    }

}
